#include "QCWidget.h"

#include <QPixmap>
#include <QStyleOption>
#include <QPainter>
#include <QStyle>
#include <QPalette>
#include <QMovie>
#include <qnamespace.h>

#pragma execution_character_set("utf-8")

QCWidget::QCWidget(QWidget *parent)
:QWidget(parent)
{

	this->setWindowFlags(Qt::FramelessWindowHint);

	mainWnd = NULL;
}

QCWidget::~QCWidget()
{

}

void QCWidget::paintEvent(QPaintEvent *e)
{
	QStyleOption opt;
	opt.initFrom(this);
	QPainter p(this);
	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
	QWidget::paintEvent(e);
}

void QCWidget::mouseMoveEvent(QMouseEvent *event)
{
	event->ignore();
}

void QCWidget::mousePressEvent(QMouseEvent *event)
{
	event->ignore();
}

void QCWidget::mouseReleaseEvent(QMouseEvent *event)
{
	event->ignore();
}

void QCWidget::setSize(int w, int h)
{
	m_nWidth = w;
	m_nHeight = h;
}


void QCWidget::setQCGeometry(int x, int y, int w, int h)
{
	this->setGeometry(x, y, w, h);
}

void QCWidget::setMainWnd(QWidget* pWidget)
{
	mainWnd = pWidget;
}

void QCWidget::moveCenter(int screenWidth, int screenHeight)
{
	int startX = (screenWidth - m_nWidth) / 2;
	int startY = (screenHeight - m_nHeight) / 2;
	this->setQCGeometry(startX, startY, m_nWidth, m_nHeight);
}